//
//  WHMineInfoView.m
//  SquirrelSeller
//
//  Created by 邓伟浩 on 2019/2/20.
//  Copyright © 2019 邓伟浩. All rights reserved.
//

#import "WHMineInfoView.h"

@interface WHMineInfoView ()

@property (nonatomic, strong) UIImageView *backImageView;

@end

@implementation WHMineInfoView

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        [self setUpUI];
    }
    return self;
}

- (void)setUpUI {
    [self addSubview:({
        _backImageView = [[UIImageView alloc] init];
        _backImageView.image = IMAGE_NAMED(@"mine_back");
        _backImageView.contentMode = UIViewContentModeScaleAspectFill;
        _backImageView;
    })];
    [_backImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.mas_equalTo(self);
    }];
    
    [self addSubview:({
        _headImageView = [[UIImageView alloc] init];
        _headImageView.contentMode = UIViewContentModeScaleAspectFit;
        _headImageView.image = IMAGE_NAMED(@"mine_defaultHeader");
        ViewRadius(_headImageView, kRealwidth(98)/2);
        _headImageView;
    })];
    
    [_headImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.mas_top).offset(kRealwidth(100));
        make.width.mas_equalTo(kRealwidth(98));
        make.height.mas_equalTo(kRealwidth(98));
        make.centerX.mas_equalTo(self.mas_centerX);
    }];
    
    [self addSubview:({
        _nameLabel = [[UILabel alloc] init];
        _nameLabel.textColor = KWhiteColor;
        _nameLabel.font = SYSTEMFONT(kRealwidth(16));
        _nameLabel;
    })];
    [_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self.mas_centerX);
        make.top.mas_equalTo(_headImageView.mas_bottom).offset(kRealwidth(15));
        make.height.mas_equalTo(kRealwidth(16));
    }];
    
    [self addSubview:({
        _phoneNumberLabel = [[UILabel alloc] init];
        _phoneNumberLabel.textColor = KWhiteColor;
        _phoneNumberLabel.font = SYSTEMFONT(kRealwidth(16));
        _phoneNumberLabel;
    })];
    [_phoneNumberLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self.mas_centerX);
        make.top.mas_equalTo(_nameLabel.mas_bottom).offset(kRealwidth(18));
        make.height.mas_equalTo(kRealwidth(16));
    }];
    
}

@end
